const validator = {
  state: {
    showFlag: false,
    uri: '',
    action: '',
    vCode: '',
    reqInstance: null
  },

  mutations: {
    SET_SHOW_FLAG: (state, flag) => {
      state.showFlag = flag
    },
    SET_URI: (state, uri) => {
      state.uri = uri
    },
    SET_ACTION: (state, action) => {
      state.action = action
    },
    CLEAR_TIMER: (state) => {
      clearInterval(state.timer);
      state.timer = null
    },
    SET_VCODE: (state, vCode) => {
      state.vCode = vCode
    },
    SET_REQ_INSTANCE: (state, reqInstance) => {
      state.reqInstance = reqInstance
    }
  },

  actions: {
    setShowFlag({ commit }, flag) {
      commit('SET_SHOW_FLAG', flag)
    },
    setUri({ commit }, uri) {
      commit('SET_URI', uri)
    },
    setAction({ commit }, action) {
      commit('SET_ACTION', action)
    },
    clearTimer({ commit }) {
      commit('CLEAR_TIMER')
    },
    setVCode({ commit }, vCode) {
      commit('SET_VCODE', vCode)
    },
    setReqInstance({ commit }, reqInstance) {
      commit('SET_REQ_INSTANCE', reqInstance)
    }
  }
}


export default validator